home *** CD-ROM | disk | other *** search
/ SGI Hot Mix 8 / Hot Mix 8.iso / .all / demos / ICS / addbxkey.lm (.txt) next >
Text File  |  1994-06-22  |  12KB  |  470 lines

  1. #!/bin/sh
  2.  
  3. SYSTEM=sgi5
  4. case $SYSTEM
  5.   in
  6.   mips | mips-cd | ibm | ibm-cd | ds3100 | ds3100-cd | sgi | sgi-cd | sgi5 | sgi5-cd | sco | sco-cd | hp700 | hp700-cd | osf | osf-cd )
  7.     DASHN=""
  8.     SLASHC=" \c"
  9.   ;;
  10.   * )
  11.     DASHN="-n"
  12.     SLASHC=" "
  13.   ;;
  14. esac
  15.  
  16. Clear()
  17. {
  18.   echo ""
  19.   echo ""
  20.   echo ""
  21.   echo ""
  22.   echo ""
  23.   echo ""
  24.   echo ""
  25.   echo ""
  26.   echo ""
  27.   echo ""
  28.   echo ""
  29.   echo ""
  30.   echo ""
  31.   echo ""
  32.   echo ""
  33.   echo ""
  34.   echo ""
  35.   echo ""
  36.   echo ""
  37.   echo ""
  38.   echo ""
  39.   echo ""
  40.   echo ""
  41.   echo ""
  42. }
  43.  
  44. Title()
  45. {
  46.   echo "================================================================================"
  47.   echo "$1"
  48.   echo "================================================================================"
  49. }
  50.  
  51. Status()
  52. {
  53.   echo ""
  54.   echo "[1] License Data File:         ${LMLICFILE}"
  55.   echo ""
  56.   echo "[2] License Type:              ${LICTYPE} Feature License"
  57.   echo "[3] License Version:           ${VERSION}"
  58.   echo "[4] Expiration Date:           ${EXPDATE}"
  59.   echo "[5] Number of Licenses:        ${LICUSERS}"
  60.   echo "[6] Activation Key:            ${ACTKEY}"
  61. }
  62.  
  63. InstallHelp()
  64. {
  65.   Title "License Activation Key Installation Help:  $HELPTITLE"
  66.   case "$HELP"
  67.     in
  68.     addmain )
  69.       echo ""
  70.       echo ""
  71.       echo ""
  72.       echo "This menu allows you to modify the various parameters involved with installing"
  73.       echo "a Builder Xcessory license activation key."
  74.       echo ""
  75.       echo "The license data file is the file that contains all the licensing information."
  76.       echo "The license type is FULL, ADA or DEMO.  If you are using the Flexible"
  77.       echo "License manager installed by another vendor's product, you can use the DEMO"
  78.       echo "setting to set up the demo version of BX.  The License Version is the"
  79.       echo "version of the Builder Xcessory for which you are installing a key.  Minor"
  80.       echo "release of Builder Xcessory do not require changes in licensing, and thus are"
  81.       echo "not indicated in the BX version string.  Therefore, when installing a key for"
  82.       echo "BX Version 3.0A, the version string to use is 3.000.  Number of licenses is"
  83.       echo "the number of licenses encoded in the activation string.  Finally, the"
  84.       echo "activation key is the encrypted key to use the licenses of BX."
  85.       echo ""
  86.       echo ""
  87.       echo ""
  88.       echo ""
  89.       AwaitEnter
  90.     ;;
  91.  
  92.     datafile )
  93.       echo ""
  94.       echo ""
  95.       echo "The License Data File is the configuration file for the Flexible License"
  96.       echo "Manager.  It contains the list of the machines acting as license servers, a"
  97.       echo "list of all vendor daemons controlled by the license servers, and a list of"
  98.       echo "all supported products (or FEATUREs).  This script is used to modify the list"
  99.       echo "of FEATUREs.  The script will add the Builder Xcessory FEATURE line if it does"
  100.       echo "not exist or modify the line if it does exist in the file."
  101.       echo ""
  102.       echo ""
  103.       echo "NOTE:  Because many vendors use the Flexible License Manager and most expect"
  104.       echo "       the license data file in a different location, be sure that you specify"
  105.       echo "       the license data file which contains the correct list of license"
  106.       echo "       servers.  If the list in the data file does not match the list encoded"
  107.       echo "       in the license activation key, the license manager will not grant any"
  108.       echo "       licenses."
  109.       echo ""
  110.       echo ""
  111.       echo ""
  112.       echo ""
  113.       AwaitEnter
  114.     ;;
  115.  
  116.     bxver )
  117.       echo ""
  118.       echo ""
  119.       echo ""
  120.       echo ""
  121.       echo ""
  122.       echo ""
  123.       echo ""
  124.       echo "The Builder Xcessory Version is the MAJOR version number of BX for which the"
  125.       echo "license activation key was generated.  This means that BX Version 3.0 and"
  126.       echo "BX Version 3.0A both use the same version string:  3.000"
  127.       echo ""
  128.       echo ""
  129.       echo ""
  130.       echo ""
  131.       echo ""
  132.       echo ""
  133.       echo ""
  134.       echo ""
  135.       echo ""
  136.       echo ""
  137.       AwaitEnter
  138.     ;;
  139.     
  140.     expdate )
  141.       echo ""
  142.       echo ""
  143.       echo ""
  144.       echo ""
  145.       echo "The License Expiration Date is the date on which BX license will expire."
  146.       echo "Under normal conditions, ICS issues open-ended licenses, that is, licenses"
  147.       echo "with no expiration date.  An unexpiring license is indicated by a year of 00."
  148.       echo ""
  149.       echo "When entering the expiration date (for BETA and EVALUATION software), user the"
  150.       echo "format:  dd-mmm-yy; where dd is a two digit day of the month."
  151.       echo "                          mmm is a three character month from the list -"
  152.       echo "                               jan, feb, mar, apr, may, jun"
  153.       echo "                               jul, aug, sep, oct, nov, dec"
  154.       echo "                          yy is a two digit year."
  155.       echo ""
  156.       echo "When installing a DEMO license, this value need not be entered."
  157.       echo ""
  158.       echo ""
  159.       echo ""
  160.       echo ""
  161.       AwaitEnter
  162.     ;;
  163.  
  164.     licuse )
  165.       echo ""
  166.       echo ""
  167.       echo ""
  168.       echo ""
  169.       echo ""
  170.       echo ""
  171.       echo "The Number of Licenses is the number of licenses encoded in the license"
  172.       echo "activation key.  It is the number of simultaneous users that the license"
  173.       echo "manager will allow to use the Builder Xcessory."
  174.       echo ""
  175.       echo "When installing a DEMO license, this value need not be entered."
  176.       echo ""
  177.       echo ""
  178.       echo ""
  179.       echo ""
  180.       echo ""
  181.       echo ""
  182.       echo ""
  183.       echo ""
  184.       echo ""
  185.       AwaitEnter
  186.     ;;
  187.  
  188.     actkey )
  189.       echo ""
  190.       echo "The License Activation Key is a 20 character code which allows the license"
  191.       echo "manager to grant licenses for a specific version of a software product based"
  192.       echo "on the number of available licenses and expiration date of those licenses."
  193.       echo "It is very important to enter this key exactly as it was given to you."
  194.       echo "Encoded in the license activation key are:"
  195.       echo ""
  196.       echo "        The list of license servers"
  197.       echo "        The version of the Builder Xcessory"
  198.       echo "        The number of simultaneous users to allow"
  199.       echo "        The expiration date of the licenses"
  200.       echo ""
  201.       echo "If any of the data do not match what was encoded into the activation key, the"
  202.       echo "key will be considered invalid by the license manager and a \"Bad Key\" error"
  203.       echo "message will be entered in the license manager log file."
  204.       echo ""
  205.       echo "When installing a DEMO license, this value need not be entered.  A valid key"
  206.       echo "will be used regardless of what is entered."
  207.       echo ""
  208.       echo ""
  209.       AwaitEnter
  210.     ;;
  211.     * )
  212.     ;;
  213.   esac
  214.   Clear
  215. }
  216.  
  217. PromptUser()
  218. {
  219.   CONTINUE=NO
  220.   while test "$CONTINUE" = "NO"
  221.     do
  222.     echo "$1 (? for Help)"
  223.     echo ${DASHN} "[$2]->${SLASHC}"
  224.     read INPUT
  225.     case "$INPUT"
  226.       in
  227.       \? )
  228.     InstallHelp
  229.       ;;
  230.       * )
  231.     if test "$INPUT" = ""
  232.       then
  233.       USERPROMPT="$2"
  234.     else
  235.       USERPROMPT="$INPUT"
  236.     fi
  237.     CONTINUE=YES
  238.       ;;
  239.     esac
  240.   done
  241. }
  242.  
  243. AwaitEnter()
  244. {
  245.   ESCAPE=N
  246.   echo ${DASHN} "Press [ENTER] to continue [X] to escape...${SLASHC}"
  247.   read INPUT
  248.   case "$INPUT"
  249.     in
  250.     [xX] )
  251.       ESCAPE=Y
  252.     ;;
  253.     * )
  254.       ESCAPE=N
  255.     ;;
  256.   esac
  257. }
  258.  
  259. LMLICDIR=
  260. LICTYPE=FULL
  261. VERSION=3.000
  262. EXPDATE=01-jan-00
  263. LICUSERS=1
  264. ACTKEY=""
  265. ACTKEYOK=N
  266. LMLICFILE="/usr/local/flexlm/licenses/license.dat"
  267.  
  268. DEMOFEAT=BuilderXcessoryDemo
  269. FULLFEAT=BuilderXcessory
  270. DAEMON=ICSBX
  271. BXSTRING="ICS Builder Xcessory"
  272. ADASTRING="ICS BX/Ada"
  273.  
  274. GO=NO
  275. while test "${GO}" = "NO"
  276.   do
  277.   CONT=NO
  278.   while test "${CONT}" = "NO"
  279.     do
  280.     HELP=addmain
  281.     HELPTITLE="Main Menu"
  282.     Clear
  283.     Title "Flexible License Manager License Key Installation"
  284.     echo ""
  285.     Status
  286.     echo ""
  287.     echo ""
  288.     echo "1.  Change license data file."
  289.     echo "2.  Change license type."
  290.     echo "3.  Change the license version."
  291.     echo "4.  Change the license expiration date."
  292.     echo "5.  Change the number of licenses."
  293.     echo "6.  Change activation key"
  294.     echo "I.  Install this key."
  295.     echo "Q.  Quit"
  296.     echo ""
  297.     echo ${DASHN} "Selection (? for Help):${SLASHC}"
  298.     read Z
  299.     case "$Z"
  300.       in
  301.       [Qq] )
  302.     echo Quit by user from menu.
  303.     exit
  304.       ;;
  305.       [Ii] )
  306.     if test "$ACTKEYOK" = "N" -a "$LICTYPE" = "FULL"
  307.       then
  308.       Clear
  309.       Title "ERROR - No Activation Key"
  310.       echo ""
  311.       echo ""
  312.       echo "You must enter a 20 character activation key in order to proceed."
  313.       echo ""
  314.       echo ""
  315.       AwaitEnter
  316.     else
  317.       ACTKEYOK=Y
  318.       CONT=YES
  319.     fi    
  320.       ;;
  321.       1 )
  322.     HELP=datafile
  323.     HELPTITLE="License Data File"
  324.     PromptUser "Enter the license data file." "${LMLICFILE}"
  325.     if [ -f "${USERPROMPT}" -a -w "${USERPROMPT}" ]
  326.       then
  327.       LMLICFILE="${USERPROMPT}"
  328.     else
  329.       Clear
  330.       Title "ERROR - Invalid License Data File"
  331.       echo ""
  332.       echo ""
  333.       echo "${USERPROMPT} does not exist or is not writable."
  334.       echo ""
  335.       echo "If this is the correct file, verify that it exists on this system and that"
  336.       echo "it is writable by you."
  337.       echo ""
  338.       echo "The license data file has not been changed."
  339.       echo ""
  340.       echo ""
  341.       AwaitEnter
  342.     fi
  343.       ;;
  344.  
  345.       2 )
  346.     if test "$LICTYPE" = "FULL"
  347.       then
  348.       LICTYPE=ADA
  349.     elif test "$LICTYPE" = "ADA"
  350.       then
  351.       LICTYPE=DEMO
  352.     else
  353.       LICTYPE=FULL
  354.     fi
  355.       ;;
  356.       
  357.       3 )
  358.     HELP=bxver
  359.     HELPTITLE="Builder Xcessory Version"
  360.     PromptUser "Enter the Builder Xcessory version." "${VERSION}"
  361.     VERSION="$USERPROMPT"
  362.       ;;
  363.       
  364.       4 )
  365.     HELP=expdate
  366.     HELPTITLE="License Expiration Date"
  367.     echo "Use the date format:  dd-mmm-yy"
  368.     echo "Valid entries for 'mmm':"
  369.     echo "        jan feb mar apr may jun"
  370.     echo "        jul aug sep oct nov dec"
  371.     echo ""
  372.     PromptUser "Enter the license expiration date." "${EXPDATE}"
  373.     EXPDATE="$USERPROMPT"
  374.       ;;
  375.     
  376.       5 )
  377.     HELP=licuse
  378.     HELPTITLE="Number of Licenses"
  379.     PromptUser "Enter the number of licenses." "${LICUSERS}"
  380.     LICUSERS="$USERPROMPT"
  381.       ;;
  382.       
  383.       6 )
  384.     HELP=actkey
  385.     HELPTITLE="License Activation Key"
  386.     PromptUser "Enter the license activation key." "${ACTKEY}"
  387.     ACTKEYLEN=`echo "$USERPROMPT" | wc -c`
  388.     if test "$ACTKEYLEN" -ne 21
  389.       then
  390.       Clear
  391.       Title "ERROR - Activation Key"
  392.       echo ""
  393.       echo ""
  394.       echo "The activation key must be exactly 20 characters in length."
  395.       echo ""
  396.       echo ""
  397.       AwaitEnter
  398.       ACTKEYOK=N
  399.     else
  400.       ACTKEYOK=Y
  401.       ACTKEY="$USERPROMPT"
  402.     fi
  403.       ;;
  404.       \? )
  405.     InstallHelp
  406.       ;;
  407.       * )
  408.       ;;
  409.     esac
  410.   done
  411.   if [ -f "${LMLICFILE}" -a -w "${LMLICFILE}" ]
  412.     then
  413.     GO=YES
  414.   else
  415.     Clear
  416.     Title "ERROR - License Data File"
  417.     echo ""
  418.     echo ""
  419.     echo "${LMLICFILE} does not exist or is not writable."
  420.     echo ""
  421.     echo "If this is the correct file, verify that it exists on this system and that"
  422.     echo "it is writable by you."
  423.     echo ""
  424.     echo ""
  425.     AwaitEnter
  426.     GO=NO
  427.     CONT=NO
  428.   fi
  429. done
  430.  
  431. Clear
  432. Title "Installing"
  433. echo ""
  434.   
  435. if test "${LICTYPE}" = "DEMO"
  436.   then
  437.   FEATURELINE="FEATURE ${DEMOFEAT} ${DAEMON}"
  438. else
  439.   FEATURELINE="FEATURE ${FULLFEAT} ${DAEMON}"
  440. fi
  441.   
  442. egrep -ve "$FEATURELINE" ${LMLICFILE} >> /tmp/tmp.dat
  443. mv /tmp/tmp.dat ${LMLICFILE}
  444.  
  445. if test "${LICTYPE}" = "DEMO"
  446.   then
  447.   ACTKEY="9B14907184E1C37F9BF8"
  448.   FEATURE="${FEATURELINE} ${VERSION} ${EXPDATE} ${LICUSERS} ${ACTKEY} \"${BXSTRING} Demo\" DEMO"
  449. elif test "${LICTYPE}" = "ADA"
  450.   then
  451.   FEATURE="${FEATURELINE} ${VERSION} ${EXPDATE} ${LICUSERS} ${ACTKEY} \"${ADASTRING}\""
  452. else
  453.   FEATURE="${FEATURELINE} ${VERSION} ${EXPDATE} ${LICUSERS} ${ACTKEY} \"${BXSTRING}\""
  454. fi
  455.  
  456. echo "The following line is being placed in ${LMLICFILE}:"
  457. echo ""
  458. echo $FEATURE
  459.  
  460. echo ${FEATURE} >> ${LMLICFILE}
  461.  
  462. echo ""
  463. echo "Flexible License Manager License Key Installation Complete."
  464.  
  465. echo ""
  466. echo "If the lmgrd is already running, you can use the lmreread utility to add the"
  467. echo "Builder Xcessory FEATURE.  If this the first time any ICS license has been"
  468. echo "added to the license data file, you will have to stop and restart the license"
  469. echo "manager using lmdown in order to start the ICSBX vendor daemon."
  470.